<!-- 已签到列表 -->
<!DOCTYPE html>
<html>
<head>
    <include file="./Public/html/_head.html"/>
    <include file="./Public/weui2.0/__head.html"/>
    <style>
    [class*="weui-col-"] {
        border: 1px solid #ccc;
        height: 40px;
        line-height: 40px;
        text-align: center;
    }
    .container:before {
        content: " ";
        position: absolute;
        left: 0;
        right: 0;
        height: 1px;
        border-top: 1px solid #D9D9D9;
        color: #D9D9D9;
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
    }
    .weui-grid {
        position: relative;
    }
    .attend,.absent,.dai,.jia {
        position: absolute;
        width: 0px;
        height: 0px;
        right: 0;
        top: 0;
        border-left: 40px solid transparent ;
    }
    .attend{
        border-top: 40px solid  #30CE4A ;
    }
    .absent {
        border-top: 40px solid  #FF0000 ;
    }
    .dai {
        border-top: 40px solid  #09ffbb ;
    }
    .jia {
        border-top: 40px solid  #f7f70c ;
    }
    .flag {
        position: absolute;
        top: -40px;
        right:3px;
        color: #fff;
        transform:rotate(45deg);
        -ms-transform:rotate(45deg);     /* IE 9 */
        -moz-transform:rotate(45deg);    /* Firefox */
        -webkit-transform:rotate(45deg); /* Safari 和 Chrome */
        -o-transform:rotate(45deg);  /* Opera */
    }
</style>
</head>
<body ontouchstart>
    <include file="./Public/html/_refresh.html"/>
    <header class='demos-header'>
        <h1 class="demos-title">签到记录</h1>
    </header>

    <div class="container" id="container">
        <volist name="signinList" id="signinList" key="k" empty="没有签到信息">
            <if condition="$signinList['flag'] eq 1"> 
                <a href="javascript:void(0);" class="weui-grid js_grid studentInfo" id="{$signinList['openId']}">
                    <div class="attend"><span class="flag">签</span></div>
                    <p class="weui-grid__label">{$signinList['name']}<br>{$signinList['number']}<br>{$signinList['class']}</p>
                </a>
                <elseif condition="$signinList['flag'] eq 0"/>
                <a href="javascript:void(0);" class="weui-grid js_grid studentInfo" id="{$signinList['openId']}">
                    <div class="absent"><span class="flag">缺</span></div>
                    <p class="weui-grid__label">{$signinList['name']}<br>{$signinList['number']}<br>{$signinList['class']}</p>
                </a>
                <elseif condition="$signinList['flag'] eq 2"/>
                <a href="javascript:void(0);" class="weui-grid js_grid studentInfo" id="{$signinList['openId']}">
                    <div class="dai"><span class="flag">代</span></div>
                    <p class="weui-grid__label">{$signinList['name']}<br>{$signinList['number']}<br>{$signinList['class']}</p>
                </a>
                <elseif condition="$signinList['flag'] eq 3"/>
                <a href="javascript:void(0);" class="weui-grid js_grid studentInfo" id="{$signinList['openId']}">
                    <div class="jia"><span class="flag">假</span></div>
                    <p class="weui-grid__label">{$signinList['name']}<br>{$signinList['number']}<br>{$signinList['class']}</p>
                </a>
            </if>
        </volist>
    </div>
    <div>
        <div class="weui-popup__overlay" id="iosMask" style="opacity: 1;display: none;"></div>
        <div class="weui-actionsheet" id="iosActionsheet">
            <div class="weui-actionsheet__title">
                <p class="weui-actionsheet__title-text"></p>
            </div>
            <div class="weui-actionsheet__menu">
                <div class="weui-actionsheet__cell" id="dai">代签</div>
                <div class="weui-actionsheet__cell" id="jia">请假</div>
                <div class="weui-actionsheet__cell" id="que">缺席</div>
            </div>
            <div class="weui-actionsheet__action">
                <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
            </div>
        </div>
    </div>
</body>
</html>
<include file="./Public/html/_foot.html"/>
<include file="./Public/html/_refreshJs.html"/>
<include file="./Public/weui2.0/__foot.html"/>
<script type="text/javascript">
    var openId;
    //控制菜单隐藏与否
    $('.studentInfo').click(function(){
        var $iosMask = $('#iosMask');
        var $iosActionsheet = $('#iosActionsheet');
        openId = this.id;
        function hideActionSheet() {
            $iosActionsheet.removeClass('weui-actionsheet_toggle');
            $iosMask.fadeOut(200);
        }
        //第一次点击则显示
        $iosActionsheet.addClass('weui-actionsheet_toggle');
        $iosMask.fadeIn(200);
        //点击mask则隐藏
        $iosMask.on('click', hideActionSheet);
        $('#iosActionsheetCancel').on('click', hideActionSheet);
        $(".studentInfo").on("click", function(){
            $iosActionsheet.addClass('weui-actionsheet_toggle');
            $iosMask.fadeIn(200);
        });

    });
    //按下按钮对应操作
    $('.weui-actionsheet__cell').on('click', function(e){
        var url = "{:U('Teacher/daiqian')}";
        data = {
            'openId': openId,
            'func'  : this.id,
        }
        $.post(url, data, function(res){
            if (res == 'error') {
                $.toast("学生ID获取失败!",'cancel');
            }else if (res == 'success'){
                window.location.reload(); 
                $.toast("修改成功!");
            }else
                $.toast("非法访问!",'cancel');
        });

    });
</script>